package com.leisure.utils;
import org.springframework.util.DigestUtils;

import java.io.UnsupportedEncodingException;

/**
 * ClassName: MD5Util
 * Package: com.leisure.utils
 * Description: MD5加密
 *
 * @Author: MyLeisureLife
 * @Date: 2024/6/5:01:26:36 星期三
 */
public class MD5Util {
    /**
     * 生成字符串的md5校验
     * @param password 密码
     * @return md5的密码
     */
    public static String getMD5String(String password){
        String MD5String = "";
        try {
            MD5String = DigestUtils.md5DigestAsHex(password.getBytes("utf-8"));

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return MD5String;
    }
}
